import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/yt_text_style.dart';
import 'package:yt_devops/components/my_gesture_detector.dart';
import 'package:yt_devops/pages/site/site_statis_data/show_full_screen_btn.dart';
import 'package:yt_devops/pages/site/widgets/full_screen_es_power_chart.dart';
import 'package:yt_devops/pages/site/widgets/full_screen_power_chart.dart';
import 'package:yt_devops/pages/site/widgets/full_screen_profit_chart.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/routers/router_path.dart';

import '../../../styles/styles.dart';

/**
 *
 * @Description TODO
 * @Author liuer
 * @CreateTime 2024年04月07日 09:28
 */
class ChargeDischargePowerTop extends StatelessWidget {
  final int selectedIndex;
   final List<dynamic> chargePower;//充电量
   final List<dynamic> dischargePower;//放电量
   final List<dynamic> profit;//收益
   final List<dynamic> chargeCost;//电费
   final List<dynamic> dischargeIncome;//收入
  final List<dynamic> barChartList;//功率
   final List<String> paramList;
   final Function(int) callback;
  final bool isHome;//如果是首页统计头部,则显示三个按钮
   const ChargeDischargePowerTop(this.selectedIndex,
       this.chargePower,this.dischargePower,this.profit,this.chargeCost,this.dischargeIncome,
       this.paramList,this.callback,
       {this.barChartList = const[],this.isHome = false,super.key});

  @override
  Widget build(BuildContext context) {
    return   Row(
      children: [
        MyGestureDetector(
          onTap: () {
            callback(0);
            // selectedIndex = 0;
            // tabController.animateTo(selectedIndex);
            // update();
          },
          child: Container(
            // margin: EdgeInsets.only(left: 16.w, right: 16.w),
            height: 30,
            width: 70,
            decoration: BoxDecoration(
              borderRadius: const BorderRadius.all(Radius.circular(15)),
              color: selectedIndex == 0
                  ? Colour.primaryColor
                  : Colour.backgroundF5F5F7Color,
              // border: Border.all(color: Colour.primaryColor,width: 1)
            ),
            alignment: Alignment.center,
            child: Text(
              ResKey.quantityOfElectricity.tr,
              textAlign: TextAlign.center,
              style: ytTextStyle(
                  fontSize: 14,
                  color:
                  selectedIndex == 0 ? Colors.white : Colour.primaryColor,
                  height: 1),
            ),
          ),
        ),
        MyGestureDetector(
          onTap: () {
            callback(1);
          },
          child: Container(
            height: 30,
            width: 70,
            decoration: BoxDecoration(
              borderRadius: const BorderRadius.all(Radius.circular(15)),
              color: selectedIndex == 1
                  ? Colour.primaryColor
                  : Colour.backgroundF5F5F7Color,
              // border: Border.all(color: Colour.primaryColor,width: 1)
            ),
            alignment: Alignment.center,
            child: Text(
              ResKey.income.tr,
              textAlign: TextAlign.center,
              style: ytTextStyle(
                  fontSize: 14,
                  color:
                  selectedIndex == 1 ? Colors.white : Colour.primaryColor,
                  height: 1),
            ),
          ),
        ),
        Visibility(
            visible: isHome,
            child: MyGestureDetector(
          onTap: () {
            callback(2);
          },
          child: Container(
            height: 30,
            width: 70,
            margin: EdgeInsets.only(left: 16.w,),
            decoration: BoxDecoration(
              borderRadius: const BorderRadius.all(Radius.circular(15)),
              color: selectedIndex == 2
                  ? Colour.primaryColor
                  : Colour.backgroundF5F5F7Color,
              // border: Border.all(color: Colour.primaryColor,width: 1)
            ),
            alignment: Alignment.center,
            child: Text(
              ResKey.power.tr,
              textAlign: TextAlign.center,
              style: ytTextStyle(
                  fontSize: 14,
                  color:
                  selectedIndex == 2 ? Colors.white : Colour.primaryColor,
                  height: 1),
            ),
          ),
        )),
        Spacer(),
        // ShowFullScreenBtn(
        //     onTap: () {
        //       if(selectedIndex == 0){
        //         Navigator.push(
        //           Get.context!,
        //           MaterialPageRoute(
        //               builder: (context) => FullScreenPowerChart(
        //                   data: [],
        //                   paramList: paramList)),
        //         );
        //       }else if(selectedIndex == 1){
        //         Navigator.push(
        //           Get.context!,
        //           MaterialPageRoute(
        //               builder: (context) => FullScreenProfitChart(
        //                   data: [],
        //                   tooltipFormatter: '',
        //                   paramList: paramList)),
        //         );
        //       }else if(selectedIndex == 2){
        //         Get.toNamed(RouterPath.energyFullChart,arguments: {
        //           'barChart':barChartList
        //         });
        //
        //       }
        //     },),
      ],
    );
  }
}
